from threading import Thread
import time

# Thread的常用方法和属性
def func():
    for i in range(5):
        print(i)
        time.sleep(1)

if __name__ == '__main__':
    thread = Thread(target=func)
    thread.start()
    print('开启了thread线程')
    print('thread线程是否is_alive', thread.is_alive())
    print('开始堵塞主线程')
    thread.join()
    thread.setName('子线程1')
    print('thread线程的name=', thread.getName())
    print('thread线程是否is_alive', thread.is_alive())
